


let url = 'www.linwt.com?name=user&age=22&phone=123456'
let url2 = 'www.linwt.com'

function parseQuery(url){
    let arrUrl = []
    let objUrl = {}
    if(url.indexOf('?') !== -1){
        arrUrl = url.split('?')[1].split('&')
        for(let i=0;i<arrUrl.length;i++){
            let keyVal = arrUrl[i].split('=')
            objUrl[keyVal[0]] = keyVal[1]
        }
    }
    return objUrl
}

console.log(parseQuery(url))
console.log(parseQuery(url2))